//
//  RoundBut.m
//  DA_V
//
//  Created by 中亿世联前台 on 15/4/21.
//  Copyright (c) 2015年 zhouhai. All rights reserved.
//

#import "RoundBut.h"

@implementation RoundBut


- (id)initWithFrame:(CGRect)frame{
  
    self = [super initWithFrame:frame];
    if (self) {
//        self.layer.masksToBounds = YES;
//        self.layer.cornerRadius = self.frame.size.width*2/4;
//        self.myTitle = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.width)];
//        self.titleEdgeInsets = UIEdgeInsetsMake(frame.size.height - 30, frame.size.width, 0, 0);
//        [self setImageEdgeInsets:UIEdgeInsetsMake(frame.size.height - 30, frame.size.width, 0, 0)];

//        self.myTitle.textAlignment = NSTextAlignmentCenter;
//        self.myTitle.textColor = [UIColor whiteColor];
//        
//        [self addSubview:self.myTitle];
        [self setTitleColor:[UIColor darkTextColor] forState:UIControlStateNormal];
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
     
    }
    return self;
    
}


- (CGRect)imageRectForContentRect:(CGRect)contentRect {//设置label的frame
    
    return CGRectMake(0, 0, self.frame.size.height - 5, self.frame.size.height - 5);

}
- (CGRect)titleRectForContentRect:(CGRect)contentRect {//设置image的frame
    return CGRectMake(0, self.frame.size.height, self.frame.size.height, 21);
    
}
//-(void)layoutSubviews{
//    self.myTitle.frame = CGRectMake(20, 20, 60, 40);
//    [super layoutSubviews];
//}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
